package com.multi.thread.chapter02.demo03;

public class PublicVar {
	
	private String username = "A";
	private String password = "AA";
	
	synchronized public void setValue(String username, String password) {
		try {
			this.username = username;
			Thread.sleep(3000);
			this.password = password;
			System.err.println("setvalue method thread name =" + Thread.currentThread().getName()
					+ ", username = " + username + ", password = " + password);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}
	
	synchronized public void getValue() {
		System.out.println("getvalue methoed thread name = " + Thread.currentThread().getName()
				+ ", username = " + username + ", password = " + password);
	}

}
